/**
 * Created by baodong on 15/10/3.
 */
function clock(elem) {
    var today = new Date();
    var h = today.getHours();
    var m = today.getMinutes();
    if (m < 10) {
        m = '0' + m;
    }
    var s = today.getSeconds();
    if (s < 10) {
        s = '0' + s;
    }

    elem.innerHTML = h+":"+m+":"+s;

    setTimeout(function(){
        clock(elem)
    },1000);
}

var clock_div = document.getElementById("clock_div");
clock(clock_div);

